{% extends 'base.html' %}

{% block extrahead%}
<link href="static/css/form.css" media="screen" rel="stylesheet"/> 
{% endblock %}

{% block content %}
    <form method='POST' action='/manage' class='simpleForm'>
        <fieldset>
            <legend>Execute queries</legend>
            <div>
                <label for='query'>Statement(s) to run</label>
                <textarea name='query' rows='10' cols='75'></textarea>
            </div>
            <div class='submit'>
                <input type='submit' value='submit'/>
            </div>
        </fieldset>
    </form>
    
    {% if errors %}
        <h3>Errors</h3>
        <ol>
            {% for item in errors %}
                <li>
                    <h4>{{ item.0 }}</h4>
                    <textarea name='query' rows='25' cols='100'>{{ item.1 }}</textarea>
                </li>
            {% endfor %}
        </ol>
    {% endif %}
    
    {% if results %}
        <h3>Results</h3>
        <ol>
            {% for item in results %}
                <li>
                    <h4>{{ item.0 }}</h4>
                    <textarea name='query' rows='25' cols='100'>{{ item.1 }}</textarea>
                </li>
            {% endfor %}
        </ol>
    {% endif %} 
{% endblock %}